<html>
<head><meta charset="utf-8"><title>Update the existing musl targets to be dy… compiler-team#422 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html">Update the existing musl targets to be dy… compiler-team#422</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232759888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/232759888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#232759888">(Apr 01 2021 at 13:55)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/compiler-team/issues/422">Update the existing musl targets to be dynamically linked. #422</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="232815405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/232815405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#232815405">(Apr 01 2021 at 19:55)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="492">@T-compiler</span>: Proposal <a href="https://github.com/rust-lang/compiler-team/issues/422#issuecomment-812136431">#422</a> has been seconded, and will be approved in 10 days if no objections are raised.</p>



<a name="233806579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233806579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233806579">(Apr 09 2021 at 11:40)</a>:</h4>
<p>Is this the right place for comments about <a href="https://github.com/rust-lang/compiler-team/issues/422">https://github.com/rust-lang/compiler-team/issues/422</a>?<br>
I might be misunderstanding the benefits of that proposal, but for me it seems like a step back. I use the <code>x86_64-unknown-linux-musl</code> target when I cross-compile from Windows to Linux. When I build on Linux for Linux I use <code>x86_64-unknown-linux-gnu</code>, but I think that target can't do cross-compilation. Now, the binaries I produce should of course run on normal (glibc-based) Linux, and preferably on Alpine Linux (the only musl-based Linux I know) as well. If I understand correctly, if the musl target were to be dynamically linked, they would stop working on normal Linux, right?<br>
Cross-compilation is <em>already</em> crippled by the fact that rustup doesn't install enough stuff to cross-compile C code, so for example simply having the <code>ring</code> crate as a (recursive) dependency already breaks it, and this proposal seems to break <em>even more</em> use cases.</p>



<a name="233809107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233809107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233809107">(Apr 09 2021 at 12:04)</a>:</h4>
<blockquote>
<p>If I understand correctly, if the musl target were to be dynamically linked, they would stop working on normal Linux, right?</p>
</blockquote>
<p>They will be dynamically linked by default, you could still specify static linking with <code>RUSTFLAGS=-Ctarget-feature=+crt-static</code></p>



<a name="233814091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233814091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233814091">(Apr 09 2021 at 12:44)</a>:</h4>
<p>Would that be possible from Cargo.toml/Cargo-config?</p>



<a name="233814462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233814462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233814462">(Apr 09 2021 at 12:47)</a>:</h4>
<p>I don't see why not, cargo.config should work</p>



<a name="233814558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233814558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233814558">(Apr 09 2021 at 12:48)</a>:</h4>
<blockquote>
<p>When I build on Linux for Linux I use x86_64-unknown-linux-gnu, but I think that target can't do cross-compilation</p>
</blockquote>
<p>I haven't tested but I would <em>expect</em> these to work with <code>+crt-static</code> too</p>



<a name="233814667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233814667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233814667">(Apr 09 2021 at 12:49)</a>:</h4>
<p>Well ok, then I don't care. :) Cross-compilation already needs <code>linker = "rust-lld"</code>, so one more config line doesn't matter. Best would be if it worked out of the box of course.</p>



<a name="233814832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233814832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233814832">(Apr 09 2021 at 12:50)</a>:</h4>
<p>yeah I definitely think we should have a blog post or something explaining exactly how to get the old behavior</p>



<a name="233815648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815648">(Apr 09 2021 at 12:57)</a>:</h4>
<blockquote>
<p>I haven't tested but I would expect these to work with +crt-static too</p>
</blockquote>
<p>Hm, I have set that <code>RUSTFLAGS</code> variable that you wrote and tried a <code>cargo build --target=x86_64-unknown-linux-gnu</code>.</p>



<a name="233815769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815769">(Apr 09 2021 at 12:58)</a>:</h4>
<p>Doesn't work.<br>
<a href="/user_uploads/4715/YJhIMpRXhaz4z8YL6yeE_hXj/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/YJhIMpRXhaz4z8YL6yeE_hXj/image.png" title="image.png"><img src="/user_uploads/4715/YJhIMpRXhaz4z8YL6yeE_hXj/image.png"></a></div>



<a name="233815870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815870">(Apr 09 2021 at 12:58)</a>:</h4>
<p>hmm maybe not if you're building with an MSVC toolchain</p>



<a name="233815972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815972">(Apr 09 2021 at 12:59)</a>:</h4>
<p>Isn't it a GNU toolchain?</p>



<a name="233815980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815980">(Apr 09 2021 at 12:59)</a>:</h4>
<p>so it is</p>



<a name="233815983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233815983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233815983">(Apr 09 2021 at 12:59)</a>:</h4>
<p>not sure then</p>



<a name="233816438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233816438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233816438">(Apr 09 2021 at 13:02)</a>:</h4>
<p>I learned about that <code>linker = "rust-lld"</code> setting in a GitHub issue that I somehow cannot find right now, but if I remember correctly they explicitly said that cross-compilation on Windows for Linux only works with <code>x86_64-unknown-linux-musl</code>.</p>



<a name="233816812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233816812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233816812">(Apr 09 2021 at 13:04)</a>:</h4>
<p>Ah, found it.<br>
<a href="https://github.com/japaric/rust-cross/issues/33#issuecomment-348802985">https://github.com/japaric/rust-cross/issues/33#issuecomment-348802985</a><br>
<a href="https://github.com/japaric/rust-cross/issues/33#issuecomment-500111581">https://github.com/japaric/rust-cross/issues/33#issuecomment-500111581</a></p>



<a name="233816907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233816907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233816907">(Apr 09 2021 at 13:05)</a>:</h4>
<p>I think just setting <code>+crt-static</code> won't work. You need to <em>build</em> glibc or musl yourself. I think <code>musl</code> works now because libstd (or  the <code>libc</code> crate, I'm not sure) distributed by rustup bundles a prebuilt musl, but I assume that will no longer be the case if libc becomes dynamically-linked by default.</p>



<a name="233816916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233816916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> André Hänsel <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233816916">(Apr 09 2021 at 13:05)</a>:</h4>
<p>The first comment says you need musl.</p>



<a name="233817237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233817237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233817237">(Apr 09 2021 at 13:07)</a>:</h4>
<blockquote>
<p>I think musl works now because libstd distributed by rustup bundled a prebuilt musl, but I assume that's no longer the case if the target becomes dynamically-linked by default.</p>
</blockquote>
<p>I mean, that doesn't necessarily have to change. I don't think removing it gets us anything other than maybe a little internal cleanup</p>



<a name="233822159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233822159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233822159">(Apr 09 2021 at 13:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233814832">said</a>:</p>
<blockquote>
<p>yeah I definitely think we should have a blog post or something explaining exactly how to get the old behavior</p>
</blockquote>
<p>This is very much the plan! The MCP just got posted to /r/rust before we had gotten that far.</p>



<a name="233822626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233822626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233822626">(Apr 09 2021 at 13:42)</a>:</h4>
<p>I think you need something like -Cself-contained=yes or something, I forget the name</p>



<a name="233823016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233823016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233823016">(Apr 09 2021 at 13:45)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> mentioned on the MCP:</p>
<blockquote>
<p>The correct combination of flags to preserve the old behavior is<br>
<code>-C target-feature=+crt-static -C link-self-contained=yes</code><br>
because the old musl targets not only link libc statically by default, they also link libc and crt objects shipped with rustc by default, which is also undesirable and should be avoided in the new target config.</p>
</blockquote>



<a name="233843390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233843390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Greg <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233843390">(Apr 09 2021 at 15:30)</a>:</h4>
<p>Is there a reason to not tie this change to the 2021 edition? That would greatly reduce the backwards incompatibility issues...</p>



<a name="233843823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233843823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233843823">(Apr 09 2021 at 15:33)</a>:</h4>
<p>editions are per crate, this is a property of the final binary</p>



<a name="233843909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233843909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233843909">(Apr 09 2021 at 15:33)</a>:</h4>
<p>also, this is a bugfix, and I don't think bugfixes should be tied to an edition</p>



<a name="233844351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233844351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Greg <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233844351">(Apr 09 2021 at 15:35)</a>:</h4>
<p>The final binary (or other artifact)... is a crate though? Just take the behavior from the edition of the final binary/artifact (which is the typical place things like target settings are read from...).</p>
<p>This changes the behavior of programs that work perfectly well, so that they don't work anymore. That's not just a bugfix.</p>



<a name="233846786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233846786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233846786">(Apr 09 2021 at 15:51)</a>:</h4>
<p>Static vs dynamic linking produces different codegen across the crate graph.</p>



<a name="233847221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233847221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Greg <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233847221">(Apr 09 2021 at 15:54)</a>:</h4>
<p>Yes, I'm not questioning that, so does setting <code>[profile.dev] opt-level=2</code>. Inheriting codegen flags of all kinds from the final crate seems to be normal, I'm not grasping why this is a problem for codegen settings that derive from editions?</p>



<a name="233848012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233848012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233848012">(Apr 09 2021 at 15:59)</a>:</h4>
<p>Worth it to remove cargo from the equation entirely as it doesn't really interact with editions in this context. Once that's done, how does rustc invocation to compile a dependency know that the final artifact will use edition2021 definition of the musl target? What if the user produces two final artifacts with different editions?</p>



<a name="233848398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233848398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233848398">(Apr 09 2021 at 16:01)</a>:</h4>
<p>There could be some sort of a solution here but thatd require a fair amount of design effort I feel</p>



<a name="233848523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233848523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233848523">(Apr 09 2021 at 16:02)</a>:</h4>
<p>To extend the edition mechanism in rustc that is</p>



<a name="233849273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233849273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Greg <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233849273">(Apr 09 2021 at 16:07)</a>:</h4>
<p><code>rustc --help</code> indicates that I can only specify one edition per invocation of rustc - so I assume you're referring to a sitution where I have another build system, I build a dependency with some fixed code gen settings, and then I try to link to it from two binaries, one with edition 2018 and one with edition 2021?</p>
<p>Or to put it another way, to link to 2018 musl crates from 2021 musl crates you'd have to pass in to one of them the flags to say "and use the other editions defaults for how to link to musl". Cargo could do that automatically, but rustc can't because it doesn't know the dependency graph at the time of compiling.</p>
<p>Ok - makes sense that that would at least be mildly problematic...</p>



<a name="233854476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233854476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Sapin <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233854476">(Apr 09 2021 at 16:41)</a>:</h4>
<p>Has it been considered to make new targets instead of a breaking change to the existing ones?</p>



<a name="233854584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233854584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233854584">(Apr 09 2021 at 16:42)</a>:</h4>
<p>yes, that was the original proposal</p>



<a name="233854603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233854603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233854603">(Apr 09 2021 at 16:42)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/82556">https://github.com/rust-lang/rust/pull/82556</a></p>



<a name="233883116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233883116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233883116">(Apr 09 2021 at 20:06)</a>:</h4>
<p>I agree that it would be nice to have a <code>--static</code> shorthand for people who want a static build like before.  Would there be any interest in adding that to cargo?  I can work on it.</p>



<a name="233883215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233883215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233883215">(Apr 09 2021 at 20:07)</a>:</h4>
<p>by all means, we <em>do not</em> want to negatively impact rust users who depend on the specific use case that was enabled by the <code>-musl</code> targets.  we just want to not have to fight those targets anymore :)</p>



<a name="233883615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233883615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233883615">(Apr 09 2021 at 20:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233817237">said</a>:</p>
<blockquote>
<blockquote>
<p>I think musl works now because libstd distributed by rustup bundled a prebuilt musl, but I assume that's no longer the case if the target becomes dynamically-linked by default.</p>
</blockquote>
<p>I mean, that doesn't necessarily have to change. I don't think removing it gets us anything other than maybe a little internal cleanup</p>
</blockquote>
<p>it seems to me, the only thing that would change is that rust ships a <code>libc.a</code> alongside the <code>libc</code> crate.  that does not seem like it is that difficult to do.</p>



<a name="233883900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233883900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233883900">(Apr 09 2021 at 20:12)</a>:</h4>
<p>anyway, i ask for everyone to be patient.  we are trying to solve a situation that came about due to lack of early communication.  there is no desire to break anybody's particular use case and i think everyone is dedicated to that</p>



<a name="233885213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233885213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233885213">(Apr 09 2021 at 20:25)</a>:</h4>
<p>i do however promise you that we're not coming for your static musl binaries.  we want people to keep doing that if they want to.  making sure that still works is <em>definitely</em> part of the goal here.</p>



<a name="233885421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233885421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233885421">(Apr 09 2021 at 20:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="360752">Ariadne Conill</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233883116">said</a>:</p>
<blockquote>
<p>I agree that it would be nice to have a <code>--static</code> shorthand for people who want a static build like before.  Would there be any interest in adding that to cargo?  I can work on it.</p>
</blockquote>
<p>If this can be added for the same release as the target behavior changes, I think it would be ideal. Write a nice blog post about it and include it in the release notes, and everyone updating their rust toolchains in CI/CD can just add the flag :)</p>



<a name="233885455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233885455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233885455">(Apr 09 2021 at 20:26)</a>:</h4>
<p>yep</p>



<a name="233896573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233896573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233896573">(Apr 09 2021 at 21:41)</a>:</h4>
<p>I'm not personally concerned about the breaking change (though I'm not convinced this would qualify as a bugfix). However, I think that any change should try to avoid additional friction when creating static binaries. <code>--target x86_64-unknown-linux-musl -C target-feature=+crt-static -C link-self-contained=yes</code> is obviously pretty bad in comparison. An <code>x86_64-unknown-linux-musl_static</code> target is one option. Another option could be the <code>--static</code> flag proposed above, though I think some more deliberation is necessary on how that should work. One idea I had was to make <code>--static</code> equivalent to today's <code>--target x86_64-unknown-linux-musl</code> on all x64 Linux hosts, but to make <code>--target x86_64-unknown-linux-gnu --static</code> statically link glibc (which wouldn't necessarily be supported, it could just be an error).</p>



<a name="233897342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233897342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233897342">(Apr 09 2021 at 21:49)</a>:</h4>
<p>This seems unrelated, though. Overall I think that changing <code>x86_64-unknown-linux-musl</code> is good, but should definitely be combined with work towards making static linking easier. Another idea is to have <code>--static</code> tie into Cargo to let crates do things like replace <code>openssl</code> with <code>rustls</code> and vendor C dependencies?</p>



<a name="233898431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898431">(Apr 09 2021 at 21:59)</a>:</h4>
<p>well rust previous behavior with the -musl target could be considered bad too depending on how you look at it</p>



<a name="233898459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898459">(Apr 09 2021 at 21:59)</a>:</h4>
<p>i call it a bug :)</p>



<a name="233898636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898636">(Apr 09 2021 at 22:00)</a>:</h4>
<p>i also think <code>--static</code> should not imply a musl target by default</p>



<a name="233898679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898679">(Apr 09 2021 at 22:00)</a>:</h4>
<p>that would be inappropriate and we may consider that problematic in the musl community :)</p>



<a name="233898720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898720">(Apr 09 2021 at 22:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239001">leo60228</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233897342">said</a>:</p>
<blockquote>
<p>This seems unrelated, though. Overall I think that changing <code>x86_64-unknown-linux-musl</code> is good, but should definitely be combined with work towards making static linking easier. Another idea is to have <code>--static</code> tie into Cargo to let crates do things like replace <code>openssl</code> with <code>rustls</code> and vendor C dependencies?</p>
</blockquote>
<p>I like the idea that crates can see if they're being compiled with <code>--static</code></p>



<a name="233898729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898729">(Apr 09 2021 at 22:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239001">leo60228</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233897342">said</a>:</p>
<blockquote>
<p>This seems unrelated, though. Overall I think that changing <code>x86_64-unknown-linux-musl</code> is good, but should definitely be combined with work towards making static linking easier. Another idea is to have <code>--static</code> tie into Cargo to let crates do things like replace <code>openssl</code> with <code>rustls</code> and vendor C dependencies?</p>
</blockquote>
<p>I think this is a very different decision, and should probably still depend on feature flags. <code>rustls</code> doesn't even work on powerpc, for example.</p>



<a name="233898901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898901">(Apr 09 2021 at 22:03)</a>:</h4>
<p>to be clear to the musl community, the use of the -musl targets in rust presently is inappropriate, in the same way that distributing a modified firefox would be seen as mozilla as inappropriate</p>



<a name="233898984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233898984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233898984">(Apr 09 2021 at 22:03)</a>:</h4>
<p>(we have discussed this at length already and the devs understand our position, i just mention it again for end users who are new.)</p>



<a name="233899219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233899219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233899219">(Apr 09 2021 at 22:05)</a>:</h4>
<p>specifically, the promotion of the concept that musl is explicitly for static linking by the rust community has done harm to musl.  rich already elaborated on that in the original PR though :)</p>



<a name="233900257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900257">(Apr 09 2021 at 22:16)</a>:</h4>
<p>I understand the issues with musl implying static, though I'm not sure I see the issue with static defaulting to musl. In my experience, musl conventional for statically linked binaries on Linux, not just for Rust code.</p>



<a name="233900540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900540">(Apr 09 2021 at 22:20)</a>:</h4>
<p>which means that you are a victim of the misrepresentation of musl as a project</p>



<a name="233900571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900571">(Apr 09 2021 at 22:20)</a>:</h4>
<p>the largest consumer of musl is alpine, the second largest is openwrt, the third largest is void</p>



<a name="233900583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900583">(Apr 09 2021 at 22:20)</a>:</h4>
<p>all of which are dynamically linked distributions</p>



<a name="233900797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900797">(Apr 09 2021 at 22:23)</a>:</h4>
<p>yes, musl is much better at static linking than glibc, and that’s something the musl community is quite happy to evangelize, but in general musl should be regarded in the same way as glibc.  the default and preferred linking mode is dynamic.</p>



<a name="233900912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233900912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233900912">(Apr 09 2021 at 22:24)</a>:</h4>
<p>if you download a prebuilt musl cross compilation toolchain from <a href="http://musl.cc">musl.cc</a>, it does not generate static binaries by default, even when cross compiling.  this is why we view the difference in rustc behavior to be inappropriate.</p>



<a name="233901097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233901097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233901097">(Apr 09 2021 at 22:26)</a>:</h4>
<p>and of course had the rust team discussed with us prior to implementing the musl port in the first place, this entire situation could have been avoided.  instead, the musl community has to basically retcon in an entirely different set of targets to replace the ones rust ships.  that’s not good for the musl community or rust, and it doesn’t make the musl community want to evangelize rust, even though many other interests are aligned</p>



<a name="233901247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233901247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233901247">(Apr 09 2021 at 22:28)</a>:</h4>
<p>this is an admittedly disruptive change but a change i hope will be fruitful, by making it easier for the musl community to support rust users, there will be more evangelism of rust in the musl community.  more adoption is good for everyone.</p>



<a name="233901371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233901371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233901371">(Apr 09 2021 at 22:30)</a>:</h4>
<p>And for the record, people <em>can</em> want to statically link glibc, for whatever reason. <code>ld</code> spits out warnings if you use features which don't work well with static linking (so DNS, dealing with users/groups, and iconv), but if you don't make use of them, things will mostly work</p>



<a name="233904835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233904835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233904835">(Apr 09 2021 at 23:11)</a>:</h4>
<p>For some reason I was under the impression that glibc was licensed under the GPL with an exception for static linking. I'm not sure where I got that idea from. <code>--static</code> on <code>x86_64-unknown-linux-gnu</code> without a <code>--target</code> flag defaulting to statically-linked glibc makes sense then, I think.</p>



<a name="233904935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233904935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233904935">(Apr 09 2021 at 23:12)</a>:</h4>
<p><code>--static</code> defaulting to musl was more that I'd like to be able to produce a working static binary with a single flag (today <code>--target=x86_64-unknown-linux-musl</code>, possibly <code>--static</code> in the future). I'm fine with other solutions that provide that too.</p>



<a name="233905017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233905017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233905017">(Apr 09 2021 at 23:13)</a>:</h4>
<p><code>--target=x86_64-unknown-linux-musl</code> does not semantically mean "give me a static binary" though.  that meaning is the result of harmful misrepresentation of the musl project by evangelists with good intentions.  the road to hell is paved with good intentions, as they say.</p>



<a name="233905878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233905878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233905878">(Apr 09 2021 at 23:24)</a>:</h4>
<p>I'm not disagreeing with that. My point is solely from a usability perspective. Today, the single flag <code>--target=x86_64-unknown-linux-musl</code> will produce a useful static binary. After any musl-related changes, I'd like there to still be a single flag that does so, though I'm less concerned about what that flag is or the implementation of it.</p>



<a name="233906231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233906231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> leo60228 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233906231">(Apr 09 2021 at 23:29)</a>:</h4>
<p>My understanding is that the proposal here is to improve the experience for people using musl-based systems, which I support. I was considering ways to avoid worsening the experience for building static Linux binaries.<br>
I think the analogy between <code>--static</code> and <code>--target=x86_64-unknown-linux-musl</code> was misleading on my part. I was just trying to clarify that I think it's important that with a theoretical <code>--static</code> flag then <code>cargo build --static</code> would "just work," without any need for something like <code>cargo build --target=x86_64-unknown-linux-musl --static</code> (which might otherwise be necessary if, for example, <code>x86_64-unknown-linux-gnu</code> didn't support dynamic linking).</p>



<a name="233913847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233913847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233913847">(Apr 10 2021 at 01:21)</a>:</h4>
<p>well, no, <code>--static</code> should give you a static binary, even if your static binary uses parts of glibc that is broken with static linking.  if you want musl, you should ask for musl with <code>--target</code>.  tools should not try to outsmart their operators, that turns them into a useful foot gun.</p>



<a name="233913958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233913958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233913958">(Apr 10 2021 at 01:22)</a>:</h4>
<p>it is a feature that your tool does exactly what you specify, nothing more or less.</p>



<a name="233913995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233913995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233913995">(Apr 10 2021 at 01:23)</a>:</h4>
<p>there is also the problem of C dependencies, if you compile dependencies with your glibc toolchain, and then staticly link them into a musl binary, bad things are likely to happen.</p>



<a name="233914007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233914007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233914007">(Apr 10 2021 at 01:23)</a>:</h4>
<p>which is a problem already</p>



<a name="233924574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233924574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233924574">(Apr 10 2021 at 04:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="360752">Ariadne Conill</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/233914007">said</a>:</p>
<blockquote>
<p>which is a problem already</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/82912">https://github.com/rust-lang/rust/issues/82912</a> for reference</p>



<a name="233926906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233926906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233926906">(Apr 10 2021 at 05:08)</a>:</h4>
<p>if you ask for --static and the target can't provide it, cargo should just <em>say that</em> and suggest an alternateive.</p>



<a name="233927230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/233927230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#233927230">(Apr 10 2021 at 05:14)</a>:</h4>
<p>sure, that would be reasonable</p>



<a name="234109417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234109417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234109417">(Apr 12 2021 at 06:30)</a>:</h4>
<p>With my cargo team hat on, I would love to see a --static option, as well as a corresponding .cargo/config.toml option (in a target's section).</p>



<a name="234109457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234109457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234109457">(Apr 12 2021 at 06:30)</a>:</h4>
<p>Short-term it should just affect the options used to build.</p>



<a name="234109483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234109483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234109483">(Apr 12 2021 at 06:31)</a>:</h4>
<p>Long-term (not in the initial version) I would love to expose that to crates so they know to link external libraries statically vs dynamically.</p>



<a name="234110504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234110504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234110504">(Apr 12 2021 at 06:43)</a>:</h4>
<p>yep that is what i had in mind <span class="user-mention" data-user-id="239881">@Josh Triplett</span> :)</p>



<a name="234208715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234208715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234208715">(Apr 12 2021 at 18:36)</a>:</h4>
<p>I've read over some of the discussion here and on the issue (although not super closely), but I figured it might be worth adding my thoughts here. My main reaction is that this change is going to likely cause a lot of breakage that's very hard to detect up-front throughout the ecosystem. Since added I (and I think many others?) have equated the Rust target with a statically linked binary to run on Linux. I saw that the migration plan involves lints but almost all of the musl build processes I've created are in CI and I don't really watch them daily so at least for me personally once this change is made I'll probably have a long tail of projects where whenever they receive a PR with failing CI I'll need to go fix them. I don't personally have an opinion on whether this change is worth the breakage or not.</p>
<p>I do, however, think that this is indicative of a larger problem that may be worth solving (not blocking this change per se, just a problem to have on the radar). Currently AFAIK there's a lot of reported pain trying to compile projects dynamically linked against musl, whereas compiling statically is much easier. I am also under the impression that the pain is "you need to pass RUSTFLAGS to Cargo". In that sense by switching the defaults it seems like it's just penalizing a different group of users. All the pain previously felt by those wishing to link dynamically will now be felt by those linking statically. I won't really pretend to think I have an answer to this, but I figured it'd be worth pointing out.</p>
<p>The last thing that I'd add is that I haven't seen anywhere the expected scale of what the breakage is going to look like. Or rather what the expected scale of "folks who need to update their build processes to pass new flags". That I realize would be very hard to measure, but would also be a very valuable data point in considering a change like this. For example making a change like this probably looks quite different if it affects 90% of Rust users vs 1%.</p>



<a name="234217584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234217584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jason Mobarak <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234217584">(Apr 12 2021 at 19:38)</a>:</h4>
<p>I definitely support the idea of a <code>--static</code> flag that's analogous to the current musl target (regardless of whether this also requires a target specification to achieve the current behavior)-- we don't use any musl dynamic targets, but we do build fully static binaries using the current musl target.  I also advocate the relative ease of creating fully static binaries as one of the benefits of Rust.</p>



<a name="234221566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234221566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234221566">(Apr 12 2021 at 20:04)</a>:</h4>
<p>Sigh, static linking is not the (whole) point of the current musl behavior.<br>
The point is "self-containedness" - you only install Rust, no extra toolchains, and you are immediately able to produce static executables (which are also self-contained).<br>
This approach requires shipping libc binaries together with Rust toolchain, so if this is something you are going to do it with the proposed "<code>--static</code> flag", then 1) the flag will be a misnomer (statically linking with non-bundled toolchain makes very much sense too, but doesn't satisfy the self-containedness property), 2) the flag will pretty much work for musl only because you cannot bundle, for example, glibc for licensing reasons, IIRC, 3) libc bundling received many complaints in the past about libc not being properly updated (which led to <a href="https://github.com/rust-lang/rust/issues/72274">#72274</a>).</p>



<a name="234228801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234228801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234228801">(Apr 12 2021 at 20:56)</a>:</h4>
<p>If I read the github issue correctly, it looks like under this proposed change, the behavior of compiling with <code>--target x86_64-unknown-linux-musl</code> will be essentially:</p>
<div class="codehilite"><pre><span></span><code>env RUSTFLAGS=&quot;-C target-feature=-crt-static&quot; cargo build --target x86_64-unknown-linux-musl
</code></pre></div>

<p>Is that right?</p>



<a name="234230651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234230651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234230651">(Apr 12 2021 at 21:04)</a>:</h4>
<p>If so, then for at least some cases (like for me), the breakage will be immediate, as compiling with <code>-C target-feature=-crt-static</code> results in an immediate build error.   If this will be true for most people, then it seems like this change might cause wide-spread annoyance, but it's not likely to cause any hard to detect "hidden effects" (for example, a build that is successful, but fails at runtime in some non-obvious way)</p>



<a name="234250303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234250303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234250303">(Apr 13 2021 at 00:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116015">Alex Crichton</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/234208715">said</a>:</p>
<blockquote>
<p>I've read over some of the discussion here and on the issue (although not super closely), but I figured it might be worth adding my thoughts here. My main reaction is that this change is going to likely cause a lot of breakage that's very hard to detect up-front throughout the ecosystem. Since added I (and I think many others?) have equated the Rust target with a statically linked binary to run on Linux. I saw that the migration plan involves lints but almost all of the musl build processes I've created are in CI and I don't really watch them daily so at least for me personally once this change is made I'll probably have a long tail of projects where whenever they receive a PR with failing CI I'll need to go fix them. I don't personally have an opinion on whether this change is worth the breakage or not.</p>
<p>I do, however, think that this is indicative of a larger problem that may be worth solving (not blocking this change per se, just a problem to have on the radar). Currently AFAIK there's a lot of reported pain trying to compile projects dynamically linked against musl, whereas compiling statically is much easier. I am also under the impression that the pain is "you need to pass RUSTFLAGS to Cargo". In that sense by switching the defaults it seems like it's just penalizing a different group of users. All the pain previously felt by those wishing to link dynamically will now be felt by those linking statically. I won't really pretend to think I have an answer to this, but I figured it'd be worth pointing out.</p>
<p>The last thing that I'd add is that I haven't seen anywhere the expected scale of what the breakage is going to look like. Or rather what the expected scale of "folks who need to update their build processes to pass new flags". That I realize would be very hard to measure, but would also be a very valuable data point in considering a change like this. For example making a change like this probably looks quite different if it affects 90% of Rust users vs 1%.</p>
</blockquote>
<p>Mostly agree, but at the same time, what rust is implying with the <code>-musl</code> targets is harmful to the musl community.  I think having a self-contained executable feature is awesome, and have nothing against that, but the association that musl == self-contained executables is fundamentally harmful to musl, to the point that we are now discussing the possibility of formulating a policy document to ensure this never happens again.  It makes sense that musl be used as a basis for this feature, but this feature should not be called "musl" if that makes sense.</p>



<a name="234251047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234251047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234251047">(Apr 13 2021 at 00:34)</a>:</h4>
<p>i would like to arrive at a scenario where the <code>-musl</code> targets do not violate musl policies, and the ability to easily make self-contained executables is retained.</p>



<a name="234251187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234251187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234251187">(Apr 13 2021 at 00:36)</a>:</h4>
<p>perhaps introducing a new set of targets explicitly for the self-contained executables feature, calling them something like <code>-sce</code>, which does all of the things needed to have musl as a self-contained executable could work for that and allow us to have <code>-musl</code> targets creating conformant binaries for musl-platform hosts</p>



<a name="234253454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234253454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234253454">(Apr 13 2021 at 01:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/234221566">said</a>:</p>
<blockquote>
<p>Sigh, static linking is not the (whole) point of the current musl behavior.<br>
The point is "self-containedness" - you only install Rust, no extra toolchains, and you are immediately able to produce static executables (which are also self-contained).<br>
This approach requires shipping libc binaries together with Rust toolchain, so if this is something you are going to do it with the proposed "<code>--static</code> flag", then 1) the flag will be a misnomer (statically linking with non-bundled toolchain makes very much sense too, but doesn't satisfy the self-containedness property), 2) the flag will pretty much work for musl only because you cannot bundle, for example, glibc for licensing reasons, IIRC, 3) libc bundling received many complaints in the past about libc not being properly updated (which led to <a href="https://github.com/rust-lang/rust/issues/72274">#72274</a>).</p>
</blockquote>
<p>So maybe <code>cargo --target  x86_64-unknown-linux-musl --self-contained</code>? Where <code>--self-contained</code> could imply <code>--static</code> (which IMO still makes sense  as a separate flag - there are cases where static linking works just fine). Then using just <code>--static</code> will use <code>libc.a</code> from the linker's library search path instead of the bundled one.</p>



<a name="234254711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234254711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234254711">(Apr 13 2021 at 01:24)</a>:</h4>
<p><span class="user-mention" data-user-id="360752">@Ariadne Conill</span> to clarify, I'm specifically not passing personal judgement on whether I agree with this change or not. My point is that irrespective of its correctness Rust has stability guarantees and I think that they're important to consider. Rust has had breaking changes in the past fixing bugs, but even small bugs which have the possibility of breaking many users are carefully scrutinized to figure out the best roll-out plan. The "have our cake" part here seems to be to switch the targets to align with other targets and the musl community, but the "eat it too" part will come from rolling this out in a way that doesn't abruptly cause the Rust community to lose faith in the compiler's stability guarantees or the compiler's musl target.</p>
<p>I realize, though, that I'm literally the one to blame for this quandry. I added the musl targets originally to Rust and advocated for their inclusion. There's not much I can do about that now, though, so I wanted to at least offer my thoughts on the stability/breakage aspect.</p>



<a name="234295783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234295783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234295783">(Apr 13 2021 at 09:38)</a>:</h4>
<p>Worth noting that targets/compiler APIs never really had a stability coverage as thorough as libs or language interfaces. This has a potential to be a change affecting most users so far compared to other breaking target changes we've done in the past, though.</p>



<a name="234325024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234325024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234325024">(Apr 13 2021 at 13:32)</a>:</h4>
<p>i like the -sce plan because it's a plan that could also be rolled out for windows and mac builds too.</p>



<a name="234333700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234333700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234333700">(Apr 13 2021 at 14:21)</a>:</h4>
<p>I don't see why we couldn't do whatever musl would do (most likely a separate component of some sort?), but distributing proprietary binaries is unlikely to be something we'd be able to do in general, I don't think.</p>



<a name="234335186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234335186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234335186">(Apr 13 2021 at 14:29)</a>:</h4>
<p>I am not aware of any proprietary code that would need to be distributed for a windows SCE.</p>



<a name="234381781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234381781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234381781">(Apr 13 2021 at 18:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> my attitude is that whatever lint is issued here, it needs to be given the same treatment as “future incompatibility lints”, which are meant to get somewhat more visiblility in the build output (in terms of being summarized at the end of even a successful build).</p>



<a name="234381842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234381842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234381842">(Apr 13 2021 at 18:59)</a>:</h4>
<p>its true that maybe people won’t even notice that. But at some point then the line is going to be “do you break the build, or do you not break the build."</p>



<a name="234382018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234382018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234382018">(Apr 13 2021 at 19:00)</a>:</h4>
<p>I want us to at least consider being willing to break the build. The project is still relatively young, we should be brave enough to fix mistakes like this.</p>



<a name="234395594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234395594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234395594">(Apr 13 2021 at 20:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> makes sense about the lints yeah. Also though I'm neither advocating for or against this change, and I agree that breakage is fine to happen in the general sense (Rust/Cargo have historically had many instances of breakage in the past). I also agree that it's ok for Rust to change these targets.</p>
<p>My points are about assessing the expected scale of breakage (this seems unlikely to be feasible and/or possible) and also about how if many folks complained about passing the <code>-Ctarget-feature=-crt-static</code> flag then there's likely also going to be many folks complaining about passing the <code>-Ctarget-feature=+crt-static</code> flag (plus the <code>-Clink-self-contained=yes</code> flag)</p>



<a name="234401054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234401054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234401054">(Apr 13 2021 at 21:05)</a>:</h4>
<p>It does seem hard to assess the scale of breakage if the diagnostic gets overlooked by our users, for whatever reason.</p>



<a name="234401658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234401658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234401658">(Apr 13 2021 at 21:07)</a>:</h4>
<p>Also, it is sounding like people are pushing for a new <code>-Clink-self-contained=yes</code> flag. I don’t mind adding that, but it does change the trade-offs here slightly, in that, under my former understanding, we were going to be able to silence the lint here by using a flag that the compiler <em>already supports</em>.</p>



<a name="234401774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234401774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234401774">(Apr 13 2021 at 21:07)</a>:</h4>
<p>But if this <code>-Clink-self-contained=yes</code> flag is going to be the official way to achieve the desired goal here, then that’s a new flag...</p>



<a name="234402291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234402291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234402291">(Apr 13 2021 at 21:09)</a>:</h4>
<p>this is a <em>very weak</em> measure, but here is a <a href="https://github.com/search?q=x86_64-unknown-linux-musl+extension%3Ayml+extension%3Ayaml+path%3A%2F.github%2F&amp;type=Code&amp;ref=advsearch&amp;l=&amp;l=">search of github</a> that I think shows how many github CI workflows build with the <code>x86_64-unknown-linux-musl</code>.  These results don't show how many are already using RUSTFLAGS to set the necessary target-feature.  But if we assume that most of these don't, then there's probably going to be about 1000 different projects that will probably have broken CI builds if they did nothing</p>
<p>(here's a <a href="https://github.com/search?l=&amp;q=x86_64-unknown-linux-musl++filename%3A.travis.yml&amp;type=code">similar search</a> for travis CI)</p>



<a name="234416540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234416540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234416540">(Apr 13 2021 at 23:17)</a>:</h4>
<p>That flag... already exists I think?</p>



<a name="234416662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234416662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234416662">(Apr 13 2021 at 23:18)</a>:</h4>
<p>well it certainly does <em>something</em></p>



<a name="234416672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234416672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234416672">(Apr 13 2021 at 23:18)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ rustc -Clink-self-contained=yes main.rs
$ ./main
Segmentation fault (core dumped)
</code></pre></div>



<a name="234416692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234416692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234416692">(Apr 13 2021 at 23:19)</a>:</h4>
<p>(this is a x86_64-unknown-linux-gnu host)</p>



<a name="234417308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234417308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234417308">(Apr 13 2021 at 23:25)</a>:</h4>
<p>that's likely because the wrong crtN.o blob is used :P</p>



<a name="234417550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234417550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234417550">(Apr 13 2021 at 23:27)</a>:</h4>
<p>what does that mean?</p>



<a name="234417612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234417612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234417612">(Apr 13 2021 at 23:28)</a>:</h4>
<p>It is (also) dynamically linked, still.</p>



<a name="234417676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234417676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234417676">(Apr 13 2021 at 23:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/234417612">said</a>:</p>
<blockquote>
<p>It is (also) dynamically linked, still.</p>
</blockquote>
<p><code>rustc -Ctarget-feature=+crt-static -Clink-self-contained=yes main.rs</code> also segfaults</p>



<a name="234417935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234417935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234417935">(Apr 13 2021 at 23:31)</a>:</h4>
<p>anyway it's not really important for gnu targets</p>



<a name="234418406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234418406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234418406">(Apr 13 2021 at 23:35)</a>:</h4>
<p>our crt object logic is documented here <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/crt_objects/index.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/crt_objects/index.html</a></p>



<a name="234435033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234435033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234435033">(Apr 14 2021 at 03:16)</a>:</h4>
<p>basically if you wind up with two instances of libc in a single binary, it will violently explode.</p>



<a name="234491315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234491315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Érico Nogueira Rolim <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234491315">(Apr 14 2021 at 12:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/234401774">said</a>:</p>
<blockquote>
<p>But if this <code>-Clink-self-contained=yes</code> flag is going to be the official way to achieve the desired goal here, then that’s a new flag...</p>
</blockquote>
<p>I'm not sure if a relevant <code>cargo</code> flag is implied here, but I think making the behavior depend on long verbose <code>RUSTFLAGS</code> setting is not really ideal; having a fully supported <code>cargo --sce</code> or similar (which removes the need, for now, for a <code>--static</code>, if we want to discuss that into the future) makes for a much better user experience, <em>and</em> avoids using the same flags for the build tools (<code>proc_macros</code> and whatever other friends)/.</p>



<a name="234504855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234504855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234504855">(Apr 14 2021 at 14:09)</a>:</h4>
<p>I was only speaking from the perspective of the interface into <code>rustc</code> up above, not the whole end-to-end experience of someone using <code>cargo</code>. I agree that we can provide a better user-experience there.</p>



<a name="234505020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234505020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234505020">(Apr 14 2021 at 14:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/234416540">said</a>:</p>
<blockquote>
<p>That flag... already exists I think?</p>
</blockquote>
<p>hmm, okay, my mistake. (Though I guess it sounds like we might have to change its current behavior, if I understand the rest of the conversation correctly.)</p>



<a name="234979018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234979018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234979018">(Apr 17 2021 at 10:37)</a>:</h4>
<p>I have a suggestion that may be silly or may be not - report all the warnings discussed above in cargo instead of rustc.</p>
<p>Cargo detects situations similar to a "typical CI setup" linked above (<a href="https://github.com/search?q=x86_64-unknown-linux-musl+extension%3Ayml+extension%3Ayaml+path%3A%2F.github%2F&amp;type=Code&amp;ref=advsearch&amp;l=&amp;l=">https://github.com/search?q=x86_64-unknown-linux-musl+extension%3Ayml+extension%3Ayaml+path%3A%2F.github%2F&amp;type=Code&amp;ref=advsearch&amp;l=&amp;l=</a>), and adds <code>-Ctarget-feature=+crt-static -Clink-self-contained=yes</code> to the compiler flags automatically with a warning and suggestion to add the flags manually.</p>



<a name="234979133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/234979133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#234979133">(Apr 17 2021 at 10:39)</a>:</h4>
<p>In this case the tool providing the suggestion will be the same tool that is to blame if the suggestion doesn't work (due to cargo's target vs host flags issues).</p>



<a name="236388198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236388198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236388198">(Apr 27 2021 at 18:40)</a>:</h4>
<p>hi, i am just checking in to see what the next steps are with this</p>



<a name="236389497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236389497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236389497">(Apr 27 2021 at 18:50)</a>:</h4>
<p>I recently made a related change: the next version of libz-sys will stop assuming that musl means static linking, and will allow dynamically linking zlib on a musl target if available.</p>



<a name="236389543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236389543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236389543">(Apr 27 2021 at 18:50)</a>:</h4>
<p>So if you're using musl and libz-sys, and want to statically link, you'll have to specify the <code>static</code> feature flag to libz-sys.</p>



<a name="236389580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236389580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236389580">(Apr 27 2021 at 18:51)</a>:</h4>
<p>(Long-term, I think cargo needs a general "I want to statically link" indication that can be passed down to library crates.)</p>



<a name="236437969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236437969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236437969">(Apr 28 2021 at 01:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="360752">Ariadne Conill</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/236388198">said</a>:</p>
<blockquote>
<p>hi, i am just checking in to see what the next steps are with this</p>
</blockquote>
<p>So the MCP itself has been seconded. I don’t think any concerns have been raised that would lead to us to abandon the proposal. I do think the proper next steps are to update the proposal itself with some additional info to help address the concerns that have been raised.</p>



<a name="236488820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236488820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236488820">(Apr 28 2021 at 11:17)</a>:</h4>
<p>The change will also obviously not happen without an implementation - 1) switching defaults in target specs, trivial + 2) compatibility layer / warnings preferably in cargo, shouldn't be hard either.</p>
<p>I'd expect one of the musl people pushing for the change to step in and implement this, otherwise it's unlikely to be done any time soon.</p>



<a name="236528823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236528823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236528823">(Apr 28 2021 at 15:33)</a>:</h4>
<p>I think I should be able to mentor the development effort, though</p>



<a name="236529001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236529001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236529001">(Apr 28 2021 at 15:34)</a>:</h4>
<p>that is, I agree with <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> that the bulk of the work should probably come from a stakeholder, but that stakeholder shouldn’t have to fear that they’d be working in a vacuum.</p>



<a name="236537011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236537011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236537011">(Apr 28 2021 at 16:23)</a>:</h4>
<p>A thought just crossed my mind that we could reasonably have a transition period here. Specifically, when building for a musl target, if we're not given an option one way or the other regarding static linking, we could attempt to detect if we have a system version of musl available to link to, and if we don't find one, we could statically link but emit a warning explaining that in the future we will default to dynamic.</p>



<a name="236537289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236537289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236537289">(Apr 28 2021 at 16:24)</a>:</h4>
<p>If you have a system version of musl that we can find, or if rustc itself is built for musl, we can skip that transition period and always assume you want to link dynamically unless you specifically request static linking.</p>



<a name="236537444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236537444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236537444">(Apr 28 2021 at 16:26)</a>:</h4>
<p>I think that behavior would help people who are currently relying on the default of static linking to transition to needing to specify that.</p>



<a name="236539365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236539365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236539365">(Apr 28 2021 at 16:38)</a>:</h4>
<p>Interesting. That's a step further than the diagnostic I was proposing</p>



<a name="236551155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236551155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236551155">(Apr 28 2021 at 17:57)</a>:</h4>
<p><span class="user-mention" data-user-id="360752">@Ariadne Conill</span> For distributions that ship dynamically linked musl binaries, is the Rust toolchain built with musl as well?</p>



<a name="236551264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236551264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236551264">(Apr 28 2021 at 17:58)</a>:</h4>
<p>(I'd assume so, unless you're cross-compiling from another system.)</p>



<a name="236574689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236574689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236574689">(Apr 28 2021 at 20:41)</a>:</h4>
<p>yes</p>



<a name="236574738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236574738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236574738">(Apr 28 2021 at 20:42)</a>:</h4>
<p>i can do the work next week, probably.</p>



<a name="236574836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236574836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236574836">(Apr 28 2021 at 20:42)</a>:</h4>
<p>i just formally became chair of the new alpine security team, so i am trying to hit the ground running with that in the immediate moment, but should be able to circle back to this next week :)</p>



<a name="236582974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236582974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236582974">(Apr 28 2021 at 21:23)</a>:</h4>
<p>Congrats! <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="236593892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236593892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236593892">(Apr 28 2021 at 23:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="360752">Ariadne Conill</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422/near/236574689">said</a>:</p>
<blockquote>
<p>yes</p>
</blockquote>
<p>Given that, I think we'd get a <em>lot</em> of benefit out of a transition period that makes musl-based toolchains default to dynamic linking for musl targets right away, and makes non-musl-based toolchains make a best effort to look for a dynamic libmusl to link to (use it if found, static link and warn for a release or two otherwise).</p>



<a name="236593962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236593962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236593962">(Apr 28 2021 at 23:07)</a>:</h4>
<p>That should allow for a fairly fast transition, and give plenty of warning to anyone who is currently assuming musl means static, without forcing any long-term issues after the transition.</p>



<a name="236601549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236601549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariadne Conill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236601549">(Apr 29 2021 at 00:35)</a>:</h4>
<p>yeah i thought we were all on the same page regarding that :)</p>



<a name="236620065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236620065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236620065">(Apr 29 2021 at 05:08)</a>:</h4>
<p>We'd talked about a transition period, but I hadn't seen any mentions of how we could make that transition smoother other than designating a cutover point and announcing it.</p>



<a name="236658027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236658027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236658027">(Apr 29 2021 at 11:35)</a>:</h4>
<p>We could potentially make it opt-in via some workspace Cargo.toml flag and make it dependent on the edition of the root. Bit awkward, but not necessarily that bad, and realistically pretty soon.</p>



<a name="236658087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/236658087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#236658087">(Apr 29 2021 at 11:36)</a>:</h4>
<p>(we could also phase it in across all editions over time like NLL after that)</p>



<a name="237697853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/237697853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#237697853">(May 06 2021 at 17:30)</a>:</h4>
<p>Hello all, according to the <a href="https://forge.rust-lang.org/compiler/mcp.html">MCP procedure</a>, this proposal should be accepted and issue <a href="https://github.com/rust-lang/rust/issues/422">#422</a>  closed. <br>
Since the discussion went to some length, I'm asking if I can close it (as the implementation will run on another track)</p>



<a name="239601468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/239601468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#239601468">(May 20 2021 at 14:31)</a>:</h4>
<p>I'm going to close the MCP as per the procedure (proposal was accepted)</p>



<a name="239601481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Update%20the%20existing%20musl%20targets%20to%20be%20dy%E2%80%A6%20compiler-team%23422/near/239601481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Update.20the.20existing.20musl.20targets.20to.20be.20dy.E2.80.A6.20compiler-team.23422.html#239601481">(May 20 2021 at 14:31)</a>:</h4>
<p>This proposal has been accepted: <a href="https://github.com/rust-lang/compiler-team/issues/422">#422</a>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>